#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct Stu Stu;
struct Stu {
    char name[20];
    int age;
};
int cmp_char(const void* p1, const void* p2)
{
    return strcmp(((Stu*)p1)->name, ((Stu*)p2)->name);
}
void test1()
{
    Stu s[] = {{.age = 22,.name = "lisi"},
        {.age = 54,.name = "wangwu" },
        {.age = 12,.name = "zhaoliu" } };
    int sz = sizeof(s) / sizeof(s[0]);
    qsort(s, sz, sizeof(s[0]), cmp_char);
    for (int i = 0; i < sz; i++)
    {
        printf("%s ", s[i].name);
        printf("%d\n", s[i].age);
    }
}
int main()
{
    test1();
    return 0;
}